/*
 * ThreeAddressInstruction.cpp
 *
 *  Created on: 25/05/2010
 *      Author: rodolfo
 */

#include "ThreeAddressInstruction.h"

ThreeAddressInstruction::ThreeAddressInstruction() {
	label = 0;
	lhs = "";
	rhs = "";
	op = "";
	result = "";

}

void ThreeAddressInstruction::print(){
	std::cout << " " << label << " " << lhs << " " << op << " " << rhs << " " << result << std::endl;
}

ThreeAddressInstruction::ThreeAddressInstruction( std::string &op, std::string &lhs, std::string &rhs, std::string &result ) :
	lhs( lhs ), rhs( rhs ), op( op ), result ( result ) {
		label = 0;
}

ThreeAddressInstruction::ThreeAddressInstruction( const ThreeAddressInstruction & instruction ){
	lhs = instruction.getLhs();
	rhs = instruction.getRhs();
	op = instruction.getOp();
	result = instruction.getResult();
	label = instruction.getLabel();
}

ThreeAddressInstruction::~ThreeAddressInstruction() {
	// TODO Auto-generated destructor stub
}

const std::string& ThreeAddressInstruction::getLhs() const {
	return lhs;
}

const std::string& ThreeAddressInstruction::getOp() const {
	return op;
}

const std::string& ThreeAddressInstruction::getResult() const {
	return result;
}

const std::string& ThreeAddressInstruction::getRhs() const {
	return rhs;
}

int ThreeAddressInstruction::getLabel() const {
	return label;
}

void ThreeAddressInstruction::setLhs( std::string &_lhs ) {
	lhs = _lhs;
}

void ThreeAddressInstruction::setOp( std::string &_op ) {
	op = _op;
}

void ThreeAddressInstruction::setResult( std::string &_result ) {
	result = _result;
}

void ThreeAddressInstruction::setRhs( std::string &_rhs ) {
	rhs = _rhs;
}

void ThreeAddressInstruction::setLabel( int _label ) {
	label = _label;
}
